package com.yd.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.yd.dao.AAdminsDao;
import com.yd.pojo.AAdmins;
import com.yd.service.IUsersService;
@Service("usersService")
public class UsersServiceImpl implements IUsersService
{
	@Resource
     private AAdminsDao adminsDao;
	
	@Override
	public JSONObject saveOneAdmins(AAdmins admins)
	{
		JSONObject jsonObject=new JSONObject();
		int res=this.adminsDao.save(admins);
		if(res>0){
			jsonObject.put("code", "0");
			jsonObject.put("info", "成功");
		}else{
			jsonObject.put("code", "1");
			jsonObject.put("info", "失败");
		}
		return jsonObject;
	}

	@Override
	public JSONObject updateOneAdmins(AAdmins admins)
	{
		JSONObject jsonObject=new JSONObject();
		int res=this.adminsDao.update(admins);
		if(res>0){
			jsonObject.put("code", "0");
			jsonObject.put("info", "成功");
		}else{
			jsonObject.put("code", "1");
			jsonObject.put("info", "失败");
		}
		return jsonObject;
	}

	@Override
	public JSONObject deleteOneAdmins(AAdmins admins)
	{
		JSONObject jsonObject=new JSONObject();
		int res=this.adminsDao.delete(admins);
		if(res>0){
			jsonObject.put("code", "0");
			jsonObject.put("info", "成功");
		}else{
			jsonObject.put("code", "1");
			jsonObject.put("info", "失败");
		}
		return jsonObject;
	}

	@Override
	public AAdmins findOneAdmins(Map<String, Object> condMap)
	{
		return this.adminsDao.findOne(condMap);
	}

	@Override
	public List<AAdmins> findCondListAdmins(Map<String, Object> condMap)
	{
		// TODO Auto-generated method stub
		return this.adminsDao.findCondList(condMap);
	}

}
